package test

import (
	"github.com/jinzhu/gorm"
	"managementsystem/conn"
	"managementsystem/structs"
)

//插入函数
func Insert(db *gorm.DB) {
	//注意不要插入多个同主键，同非空的值， 否则报错
	course := structs.C{Cname: "A",Cno: "31",Cgrade: 4,Cterm: 1}
	db.Table("c").NewRecord(course)
	err := db.Table("c").Create(&course).Error
	db.Table("c").NewRecord(course)
	conn.ErrCheck(err)
}
